#!/bin/bash

for i in \
    airy \
    aitoff \
    armadillo \
    august \
    baker \
    berghaus \
    bertin1953 \
    boggs \
    bonne \
    bottomley \
    bromley \
    chamberlinAfrica \
    collignon \
    craig \
    craster \
    cylindricalEqualArea \
    cylindricalStereographic \
    eckert1 \
    eckert2 \
    eckert3 \
    eckert4 \
    eckert5 \
    eckert6 \
    eisenlohr \
    fahey \
    foucaut \
    gilbert \
    gingery \
    ginzburg4 \
    ginzburg5 \
    ginzburg6 \
    ginzburg8 \
    ginzburg9 \
    gringorten \
    gringortenQuincuncial \
    guyou \
    hammer \
    hammerRetroazimuthal \
    healpix \
    hill \
    homolosine \
    interruptedBoggs \
    interruptedHomolosine \
    interruptedMollweide \
    interruptedMollweideHemispheres \
    interruptedSinusoidal \
    interruptedSinuMollweide \
    kavrayskiy7 \
    lagrange \
    larrivee \
    laskowski \
    littrow \
    loximuthal \
    miller \
    modifiedStereographicAlaska \
    modifiedStereographicGs48 \
    modifiedStereographicGs50 \
    modifiedStereographicMiller \
    modifiedStereographicLee \
    mollweide \
    mtFlatPolarParabolic \
    mtFlatPolarQuartic \
    mtFlatPolarSinusoidal \
    naturalEarth \
    naturalEarth2 \
    nellHammer \
    patterson \
    peirceQuincuncial \
    polyconic \
    polyhedralButterfly \
    polyhedralCollignon \
    polyhedralWaterman \
    rectangularPolyconic \
    robinson \
    satellite \
    sinuMollweide \
    sinusoidal \
    times \
    twoPointAzimuthalUsa \
    twoPointEquidistantUsa \
    vanDerGrinten \
    vanDerGrinten2 \
    vanDerGrinten3 \
    vanDerGrinten4 \
    wagner4 \
    wagner6 \
    wagner7 \
    wiechel \
    winkel3 \
    ; do
  test/render-world $i > test/output/$i.png \
      && [ "$(gm compare -metric rmse img/$i.png test/output/$i.png 2>&1)" = "Image Difference (RootMeanSquaredError):
           Normalized    Absolute
          ============  ==========
     Red: 0.0000000000        0.0
   Green: 0.0000000000        0.0
    Blue: 0.0000000000        0.0
   Total: 0.0000000000        0.0" ] \
      && echo -e "\x1B[1;32m✓ $2\x1B[0mtest/output/$i.png" \
      && rm -f -- test/output/$i-difference.png \
      || (gm compare -type TrueColor -highlight-style assign -highlight-color red -file test/output/$i-difference.png test/output/$i.png img/$i.png; \
          echo -e "\x1B[1;31m✗ $2\x1B[0mtest/output/$i.png\n  test/output/$i-difference.png")
done
